package com.cheng.lesson04;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

public class URLDemon01 {
    public static void main(String[] args) throws IOException {
        URL url = new URL("https://www.chinanews.com/sh/2021/01-25/9395546.shtml");

        System.out.println(url.getAuthority());//作者名
        System.out.println(url.getProtocol());//协议名
        System.out.println(url.getPort());//端口
        System.out.println(url.getFile());//文件地址
        System.out.println(url.getHost());//主机ip
        System.out.println(url.getPath());//文件全路径
    }
}
